/*
 * Copyright 2009 Jesse McLaughlin (nzjess@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *         http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.travelfusion.xmlclient.ri.xobject.plane;

import java.util.Date;

import org.travelfusion.xmlclient.util.TimeZoneDelta;
import org.travelfusion.xmlclient.xobject.XRequestBean;

/**
 * Represents a StartRouting command, which is used to initiate a search for flights.
 * 
 * @author Jesse McLaughlin (nzjess@gmail.com)
 */
public class XStartRoutingRequest extends XRequestBean implements TimeZoneDelta {

  private static final long serialVersionUID = 1L;

  private String origin;
  private String originType;
  private int originRadius;
  private boolean originAI = false;

  private String destination;
  private String destinationType;
  private int destinationRadius;
  private boolean destinationAI = false;

  private Date outwardDate;
  private int outwardDateDays = 0;
  private Date returnDate;
  private int returnDateDays = 0;

  private int numAdults = 1;
  private int numChildren = 0;
  private int numInfants = 0;

  private int maxChanges = 2;

  private int timeOutSeconds = 60;

  private boolean searchCacheOnly = false;

  public String getOrigin() {
    return origin;
  }

  /**
   * Where to fly from. May be a city TLA, eg. LON; an airport TLA, eg. LHR; or a coordinate in lat,lon format, eg.
   * 51.015,-0.0089.
   */
  public void setOrigin(String origin) {
    this.origin = origin;
  }

  public String getOriginType() {
    return originType;
  }

  /**
   * May be 'citycode', 'airportgroup', 'airportcode', or 'coordinate'.
   */
  public void setOriginType(String originType) {
    this.originType = originType;
  }

  public int getOriginRadius() {
    return originRadius;
  }

  /**
   * If origin type is not 'airportcode', then this sets the radius (in meters) around the origin to route flights from.
   * Otherwise, may be zero.
   */
  public void setOriginRadius(int originRadius) {
    this.originRadius = originRadius;
  }

  public boolean isOriginAI() {
    return originAI;
  }

  /**
   * True to enable 'airport intelligence' routing mode for origin.
   */
  public void setOriginAI(boolean originAI) {
    this.originAI = originAI;
  }

  public String getDestination() {
    return destination;
  }

  /**
   * @see #setOrigin(String)
   */
  public void setDestination(String destination) {
    this.destination = destination;
  }

  public String getDestinationType() {
    return destinationType;
  }

  /**
   * @see #setOriginType(String)
   */
  public void setDestinationType(String destinationType) {
    this.destinationType = destinationType;
  }

  public int getDestinationRadius() {
    return destinationRadius;
  }

  /**
   * @see #setOriginRadius(int)
   */
  public void setDestinationRadius(int destinationRadius) {
    this.destinationRadius = destinationRadius;
  }

  public boolean isDestinationAI() {
    return destinationAI;
  }

  /**
   * True to enable 'airport intelligence' routing mode for destination.
   */
  public void setDestinationAI(boolean destinationAI) {
    this.destinationAI = destinationAI;
  }

  public Date getOutwardDate() {
    return outwardDate;
  }

  public void setOutwardDate(Date outwardDate) {
    this.outwardDate = outwardDate;
  }

  public int getOutwardDateDays() {
    return outwardDateDays;
  }

  /**
   * Size of search window around outward date.
   */
  public void setOutwardDateDays(int outwardDateDays) {
    this.outwardDateDays = outwardDateDays;
  }

  public Date getReturnDate() {
    return returnDate;
  }

  /**
   * Set this to <code>null</code> to perform a 'one-way' search.
   */
  public void setReturnDate(Date returnDate) {
    this.returnDate = returnDate;
  }

  public int getReturnDateDays() {
    return returnDateDays;
  }

  /**
   * Size of search window around return date.
   */
  public void setReturnDateDays(int returnDateDays) {
    this.returnDateDays = returnDateDays;
  }

  public int getNumAdults() {
    return numAdults;
  }

  /**
   * Number of adult travellers. Defaults to 1.
   */
  public void setNumAdults(int numAdults) {
    this.numAdults = numAdults;
  }

  public int getNumChildren() {
    return numChildren;
  }

  /**
   * Number of child travellers. Defaults to 0.
   */
  public void setNumChildren(int numChildren) {
    this.numChildren = numChildren;
  }

  public int getNumInfants() {
    return numInfants;
  }

  /**
   * Number of infant travellers. Defaults to 0.
   */
  public void setNumInfants(int numInfants) {
    this.numInfants = numInfants;
  }

  public int getMaxChanges() {
    return maxChanges;
  }

  public void setMaxChanges(int maxChanges) {
    this.maxChanges = maxChanges;
  }

  public void setTimeOutSeconds(int timeOutSeconds) {
    this.timeOutSeconds = timeOutSeconds;
  }

  public int getTimeOutSeconds() {
    return timeOutSeconds;
  }

  @Deprecated
  public int getTZDeltaMinutes() {
    return 0;
  }

  /**
   * If required, set this to the number of minutes (plus or minus) between the timezone of the system where the
   * response data will be used, and the timezone of the system invoking the TRAVELfusion TripPlanner XML service.
   * <p>
   * This value can normally be left as zero (the default), but it can be useful where the data will be transported
   * across a protocol that does not propagate timezone information (eg. GWT RPC).
   */
  @Deprecated
  public void setTZDeltaMinutes(int tzDeltaMinutes) {
  }

  public boolean isSearchCacheOnly() {
    return searchCacheOnly;
  }

  public void setSearchCacheOnly(boolean searchCacheOnly) {
    this.searchCacheOnly = searchCacheOnly;
  }
}
